@extends('layout.member.master')
@section('content')
    <div class="card mt-3 ">
        <div class="card-header mb-3">
            消息列表
        </div>
        <div class="card-block">
            <div class="card mb-3">
                <div class="card-body">

                    @foreach (auth()->user()->notifications as $notification)
                        <div class="row align-items-center">
                            <div class="col-auto">
                                <a href="{{route('member.message.show',$notification->id)}}" class="avatar avatar-lg">
                                    <img src="{{$notification['data']['user_icon']}}" alt="..."
                                         class="avatar-img rounded-circle">
                                </a>
                            </div>
                            <div class="col ml--2">
                                <!-- Title -->
                                <h4 class="card-title mb-1">
                                    <a href="profile-posts.html">{{$notification['data']['user_name']}}
                                        @if($notification->read_at)
                                        <span  class="badge badge-soft-success ml-3">已读</span>
                                         @else
                                        <span  class="badge badge-soft-info ml-3">未读</span>
                                        @endif
                                    </a>
                                </h4>
                                <!-- Text -->
                                <p class="card-text small text-muted mb-1">
                                    评论了您的文章：{{$notification['data']['article_title']}}
                                </p>
                                <!-- Status -->
                                <p class="card-text small">
                                    <span class="text-black-50">{{$notification->created_at->diffForHumans()}}</span>
                                </p>
                            </div>
                            <div class="col-auto">
                                <a href="{{route('member.message.destroy',['id'=>$notification->id])}}" class="btn btn-sm btn-primary d-none d-md-inline-block">
                                    删除
                                </a>
                            </div>
                        </div>
                        <hr>
                    @endforeach
                </div>

            </div>
        </div>
        <div class="card-footer text-muted">
            底部
        </div>
    </div>
@endsection
@push('js')
    {{--{{$notification['data']['link']}}--}}
    {{--<script>--}}
        {{--function show(obj) {--}}
            {{--alert(obj);--}}
        {{--}--}}
    {{--</script>--}}
    @endpush

